/*
** Lua binding: toluaclass
** Generated automatically by tolua++-1.0.92 on 05/27/16 16:35:02.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

/* Exported function */
extern "C" __declspec(dllexport) int  tolua_toluaclass_open (lua_State* tolua_S);

#include "toluaclass.h"

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_CDerived1 (lua_State* tolua_S)
{
 CDerived1* self = (CDerived1*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}

static int tolua_collect_CDerived2 (lua_State* tolua_S)
{
 CDerived2* self = (CDerived2*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}

static int tolua_collect_CBase (lua_State* tolua_S)
{
 CBase* self = (CBase*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"CDerived1");
 tolua_usertype(tolua_S,"CDerived2");
 tolua_usertype(tolua_S,"CBase");
}

/* method: new of class  CBase */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CBase_new00
static int tolua_toluaclass_CBase_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CBase",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CBase* tolua_ret = (CBase*)  new CBase();
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"CBase");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  CBase */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CBase_new00_local
static int tolua_toluaclass_CBase_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CBase",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CBase* tolua_ret = (CBase*)  new CBase();
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"CBase");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  CBase */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CBase_delete00
static int tolua_toluaclass_CBase_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CBase",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CBase* self = (CBase*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ShowMessage of class  CBase */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CBase_ShowMessage00
static int tolua_toluaclass_CBase_ShowMessage00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CBase",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CBase* self = (CBase*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShowMessage'",NULL);
#endif
  {
   self->ShowMessage();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ShowMessage'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ClassName of class  CBase */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CBase_ClassName00
static int tolua_toluaclass_CBase_ClassName00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CBase",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   char* tolua_ret = (char*)  CBase::ClassName();
   tolua_pushstring(tolua_S,(const char*)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ClassName'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new of class  CDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived1_new00
static int tolua_toluaclass_CDerived1_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CDerived1",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CDerived1* tolua_ret = (CDerived1*)  new CDerived1();
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"CDerived1");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  CDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived1_new00_local
static int tolua_toluaclass_CDerived1_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CDerived1",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CDerived1* tolua_ret = (CDerived1*)  new CDerived1();
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"CDerived1");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  CDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived1_delete00
static int tolua_toluaclass_CDerived1_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived1",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived1* self = (CDerived1*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ShowMessage of class  CDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived1_ShowMessage00
static int tolua_toluaclass_CDerived1_ShowMessage00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived1",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived1* self = (CDerived1*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShowMessage'",NULL);
#endif
  {
   self->ShowMessage();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ShowMessage'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ShowDerived1 of class  CDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived1_ShowDerived100
static int tolua_toluaclass_CDerived1_ShowDerived100(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived1",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived1* self = (CDerived1*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShowDerived1'",NULL);
#endif
  {
   self->ShowDerived1();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ShowDerived1'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_new00
static int tolua_toluaclass_CDerived2_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CDerived2* tolua_ret = (CDerived2*)  new CDerived2();
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"CDerived2");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_new00_local
static int tolua_toluaclass_CDerived2_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   CDerived2* tolua_ret = (CDerived2*)  new CDerived2();
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"CDerived2");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_delete00
static int tolua_toluaclass_CDerived2_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived2* self = (CDerived2*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ShowMessage of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_ShowMessage00
static int tolua_toluaclass_CDerived2_ShowMessage00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived2* self = (CDerived2*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShowMessage'",NULL);
#endif
  {
   self->ShowMessage();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ShowMessage'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: ShowDerived2 of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_ShowDerived200
static int tolua_toluaclass_CDerived2_ShowDerived200(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived2* self = (CDerived2*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShowDerived2'",NULL);
#endif
  {
   self->ShowDerived2();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'ShowDerived2'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: SetNumber of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_SetNumber00
static int tolua_toluaclass_CDerived2_SetNumber00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived2* self = (CDerived2*)  tolua_tousertype(tolua_S,1,0);
  int num = ((int)  tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetNumber'",NULL);
#endif
  {
   self->SetNumber(num);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'SetNumber'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: GetNumber of class  CDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_CDerived2_GetNumber00
static int tolua_toluaclass_CDerived2_GetNumber00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CDerived2",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CDerived2* self = (CDerived2*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumber'",NULL);
#endif
  {
   int tolua_ret = (int)  self->GetNumber();
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'GetNumber'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: toDerived1 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_toDerived100
static int tolua_toluaclass_toDerived100(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isuserdata(tolua_S,1,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  void* p = ((void*)  tolua_touserdata(tolua_S,1,0));
  {
   CDerived1* tolua_ret = (CDerived1*)  toDerived1(p);
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"CDerived1");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'toDerived1'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: toDerived2 */
#ifndef TOLUA_DISABLE_tolua_toluaclass_toDerived200
static int tolua_toluaclass_toDerived200(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isuserdata(tolua_S,1,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  void* p = ((void*)  tolua_touserdata(tolua_S,1,0));
  {
   CDerived2& tolua_ret = (CDerived2&)  toDerived2(p);
   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"CDerived2");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'toDerived2'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
int tolua_toluaclass_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"CBase","CBase","",tolua_collect_CBase);
  #else
  tolua_cclass(tolua_S,"CBase","CBase","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"CBase");
   tolua_function(tolua_S,"new",tolua_toluaclass_CBase_new00);
   tolua_function(tolua_S,"new_local",tolua_toluaclass_CBase_new00_local);
   tolua_function(tolua_S,".call",tolua_toluaclass_CBase_new00_local);
   tolua_function(tolua_S,"delete",tolua_toluaclass_CBase_delete00);
   tolua_function(tolua_S,"ShowMessage",tolua_toluaclass_CBase_ShowMessage00);
   tolua_function(tolua_S,"ClassName",tolua_toluaclass_CBase_ClassName00);
  tolua_endmodule(tolua_S);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"CDerived1","CDerived1","CBase",tolua_collect_CDerived1);
  #else
  tolua_cclass(tolua_S,"CDerived1","CDerived1","CBase",NULL);
  #endif
  tolua_beginmodule(tolua_S,"CDerived1");
   tolua_function(tolua_S,"new",tolua_toluaclass_CDerived1_new00);
   tolua_function(tolua_S,"new_local",tolua_toluaclass_CDerived1_new00_local);
   tolua_function(tolua_S,".call",tolua_toluaclass_CDerived1_new00_local);
   tolua_function(tolua_S,"delete",tolua_toluaclass_CDerived1_delete00);
   tolua_function(tolua_S,"ShowMessage",tolua_toluaclass_CDerived1_ShowMessage00);
   tolua_function(tolua_S,"ShowDerived1",tolua_toluaclass_CDerived1_ShowDerived100);
  tolua_endmodule(tolua_S);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"CDerived2","CDerived2","CBase",tolua_collect_CDerived2);
  #else
  tolua_cclass(tolua_S,"CDerived2","CDerived2","CBase",NULL);
  #endif
  tolua_beginmodule(tolua_S,"CDerived2");
   tolua_function(tolua_S,"new",tolua_toluaclass_CDerived2_new00);
   tolua_function(tolua_S,"new_local",tolua_toluaclass_CDerived2_new00_local);
   tolua_function(tolua_S,".call",tolua_toluaclass_CDerived2_new00_local);
   tolua_function(tolua_S,"delete",tolua_toluaclass_CDerived2_delete00);
   tolua_function(tolua_S,"ShowMessage",tolua_toluaclass_CDerived2_ShowMessage00);
   tolua_function(tolua_S,"ShowDerived2",tolua_toluaclass_CDerived2_ShowDerived200);
   tolua_function(tolua_S,"SetNumber",tolua_toluaclass_CDerived2_SetNumber00);
   tolua_function(tolua_S,"GetNumber",tolua_toluaclass_CDerived2_GetNumber00);
  tolua_endmodule(tolua_S);
  tolua_function(tolua_S,"toDerived1",tolua_toluaclass_toDerived100);
  tolua_function(tolua_S,"toDerived2",tolua_toluaclass_toDerived200);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 int luaopen_toluaclass (lua_State* tolua_S) {
 return tolua_toluaclass_open(tolua_S);
};
#endif

